<template>
	<view>
		<template>
			<view style="width: 100%;display: flex;">

				<block v-if="((item.category)&&(item.category.image))">
					<view style="width: 40%;margin-right: 5%;">
						<view class="carPicture">
							<image mode="widthFix" v-if="((item.category)&&(item.category.image))"
								:src="toImages(item.category.image)" alt="" />
						</view>
					</view>
				</block>
				<block v-else>
					<view style="width: 40%;margin-right: 5%;" v-if="((item)&&(item.car_category_image))">
						<view class="carPicture">
							<image mode="widthFix" v-if="((item)&&(item.car_category_image))"
								:src="toImages(item.car_category_image)" alt="" />
						</view>
					</view>
				</block>



				<view style="width: 60%;">
					<view class="title" v-if="isOrder!=1"
						style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
						{{ item.category[$t('item.name')]|| $t("暂无信息") }}
					</view>

					<view class="title" v-if="isOrder==1&&item.car_category_name"
						style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
						<text v-if="lang==='zh'">{{ item.car_category_name }}</text>
						<text v-if="lang !='zh'">{{ item.car_category_name_ru }}</text>
					</view>

					<view class="lineP">
						<view style="flex: 1;">
							<view class="lineP">
								<block v-if="((item.whole_diffuse)&&(item.whole_diffuse.value))">
									<Tag class="u-margin-bottom-14" :text="$t(item.whole_diffuse.value) || ''"
										color="#028AFA">
									</Tag>
								</block>
								<block v-else>
									<Tag class="u-margin-bottom-14" :text="$t(item.whole_diffuse) || ''"
										color="#028AFA">
									</Tag>
								</block>

								<Tag class="u-margin-bottom-14" :text="item.load_num+'kg'" color="#FF7105"></Tag>
								<Tag class="u-margin-bottom-14" :text="item.goods_volume+'m³'" color="#11B4AF"></Tag>
								<!-- <Tag class="u-margin-bottom-14"
									:text="item.car_l + 'm*'  + item.car_w + 'm*'  + item.car_h + 'm' || ''" color="#13b5b1">
								</Tag> -->
							</view>
							<view class="lineP u-margin-bottom-0" style="transform: scale(.9);margin-left:-18rpx;">
								<FromToCountry :item="item"></FromToCountry>
							</view>
							<view class="lineP" v-if="false">
								{{item.car_l + 'm*'  + item.car_w + 'm*'  + item.car_h + 'm' || ''}}
							</view>
						</view>
					</view>
				</view>
			</view>


			<view class="address" v-if="isOrder!=1">
				<div class="icon">
					<image :src="HTTP_IMG_UTL+'tubiao1.png'" class="headline_img" />
				</div>
				<view>
					<view class="label">{{$t("出发城市")}}</view>
					<view class="u-flex-1 value">
						{{item.hyd }}
					</view>
				</view>
			</view>
			<view class="address" v-if="isOrder!=1">
				<view class="label">{{$t("到达城市")}}</view>
				<image :src="HTTP_IMG_UTL+'tubiao2.png'" class="headline_img" />
				<view class="u-flex-1">
					{{item.shd }}
				</view>
			</view>

			<view class="address" v-if="isOrder==1">
				<div class="icon">
					<image :src="HTTP_IMG_UTL+'tubiao1.png'" class="headline_img" />
				</div>
				<view>
					<view class="label">{{$t("出发城市")}}</view>
					<view class="u-flex-1 value">
						<!-- <text v-if="lang==='zh'">{{ item.departure_address }}</text> -->
						<text v-if="lang==='zh'">{{ item.departure_city.mergename }}</text>
						<text v-if="lang !='zh'">{{ item.departure_city.mergename_ru }}</text>
					</view>
				</view>
			</view>
			<view class="address" v-if="isOrder==1">
				<div class="icon">
					<image :src="HTTP_IMG_UTL+'tubiao2.png'" class="headline_img" />
				</div>
				<view>
					<view class="label">{{$t("到达城市")}}</view>
					<view class="u-flex-1 value">
						<text v-if="lang==='zh'">{{ item.reach_city.mergename }}</text>
						<text v-if="lang !='zh'">{{ item.reach_city.mergename_ru }}</text>
					</view>
				</view>
			</view>

		</template>

	</view>
</template>

<script>
	import {
		createC2CConversation,
		isBase64,
		time
	} from "@/common/public";
	import FromToCountry from '@/components/FromToCountry.vue'

	import Tag from '@/components/Tag.vue'
	import {
		IMAGE_URL,
		HTTP_IMG_UTL
	} from "@/config/app";
	export default {
		components: {
			Tag,
			FromToCountry
		},
		props: {
			item: {
				type: Object,
				default: {},
			},
			type: {
				type: String | Number,
				default: '1',
			},
			isOrder: {
				type: [Boolean, Number],
				default: 1,
			}
		},
		computed: {
			toImages() {
				return (src) => {
					if (src) {
						return isBase64(src) ? src : IMAGE_URL + src
					} else {
						return ''
					}
				}
			},
		},
		data() {
			return {
				lang: this.$i18n.locale,
				HTTP_IMG_UTL
			};
		},
		methods: {
			time
		}
	}
</script>

<style lang="scss" scoped>
	.carPicture {
		display: flex;
		align-items: center;
		height: 260rpx;

		image {
			width: 220rpx;
		}
	}

	.lineP {
		display: flex;
		align-items: center;
		margin-bottom: 8px;
		position: relative;
		font-size: 16px;
		position: relative;
		flex-wrap: wrap;


		&.shot {
			width: 50%;
			flex-wrap: wrap;


		}



		.headline_img {
			width: 30rpx;
			height: 30rpx;
			margin-right: 10rpx;
		}

		.label {
			font-weight: 600;
			margin-bottom: 10rpx;
		}
	}

	.title {
		color: #e43b14;
		font-size: 32rpx;
		// border-top: 1rpx solid #cccccc;
		font-weight: 600;
		margin-top: 10rpx;
		word-break: break-all;
		// min-height: 80rpx;
		margin-bottom: 20rpx;
	}

	.address {
		margin-bottom: 24rpx;
		font-size: 28rpx;
		position: relative;
		display: flex;
		// font-weight: 600;

		// .warp {
		// 	width: 55%;
		// }

		.headline_img {
			width: 30rpx;
			height: 30rpx;
		}

		.value {
			font-weight: bold;
			font-size: 24rpx;
			color: #3d3d3d;
		}

		.label {
			margin-bottom: 2px;
			font-size: 22rpx;
			color: #3d3d3d;
		}
	}

	.icon {
		width: 60rpx;
		height: 60rpx;
		border-radius: 8rpx;
		background: #F5F4F9;
		display: flex;
		align-items: center;
		justify-content: center;
		position: relative;
		margin-right: 16rpx;
	}
	.value {
		font-weight: bold;
		font-size: 24rpx;
		color: #3d3d3d;
	}
</style>